package com.mt.restaurant.dao.material;

import com.mt.common.core.web.base.PageDTO;
import com.mt.common.core.web.base.PageResultDTO;
import com.mt.restaurant.entity.material.MaterialOrder;
import com.mt.restaurant.entity.material.OrderMaterialRelation;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
import org.apache.ibatis.annotations.Param;
import java.util.List;

@Mapper
@Component(value = "orderMaterialRelationDao")
public interface OrderMaterialRelationDao {

    /**
    * 根据分页参数查询订单材料关系集合
    *
    * @param pageDTO 分页条件
    */
    public List<OrderMaterialRelation> findOrderMaterialRelations(PageDTO pageDTO);

    /**
    * 查询全部订单材料关系集合
    *
    */
    public List<OrderMaterialRelation> findAllOrderMaterialRelations();

    /**
    * 查询所有订单材料关系集合(只提取ID 和 Name)
    *
    */
    public List<OrderMaterialRelation> findAllOrderMaterialRelationsWithIdName();

    /**
    * 根据名称查询订单材料关系集合(只提取ID 和 Name)
    *
    * @param orderMaterialRelationName 名称
    */
    public List<OrderMaterialRelation> findOrderMaterialRelationsWithIdNameByName(@Param("orderMaterialRelationName") String orderMaterialRelationName);

    /**
    * 根据ID查询指定的订单材料关系(只提取ID 和 Name)
    *
    * @param orderMaterialRelationId Id
    */
    public OrderMaterialRelation findOrderMaterialRelationsWithIdNameById(@Param(" orderMaterialRelationId") Long orderMaterialRelationId);

    /**
    * 根据分页参数查询订单材料关系集合的数量
    *
    * @param pageDTO 分页条件
    */
    public Long findOrderMaterialRelationTotalCount(PageDTO pageDTO);

    /**
    * 根据ID查询指定的订单材料关系
    *
    * @param orderMaterialRelationId Id
    */
    public OrderMaterialRelation findOrderMaterialRelation(@Param("orderMaterialRelationId") Long orderMaterialRelationId);

    /**
    * 根据ID查询指定的订单材料关系(包含外键)
    *
    * @param orderMaterialRelationId Id
    */
    public OrderMaterialRelation findOrderMaterialRelationWithForeignName(@Param("orderMaterialRelationId") Long orderMaterialRelationId);

    public List<OrderMaterialRelation> findOrderMaterialsByOrder(@Param("materialOrderList") List<MaterialOrder> materialOrderList);

    public List<OrderMaterialRelation> findOrderMaterialsByOrderId(@Param("materialOrderId") Long materialOrderId);

    /**
    * 新增订单材料关系
    *
    * @param orderMaterialRelation 实体对象
    */
    public Long saveOrderMaterialRelation(OrderMaterialRelation orderMaterialRelation);


    /**
    * 更新订单材料关系
    *
    * @param orderMaterialRelation 实体对象
    */
    public Long updateOrderMaterialRelation(OrderMaterialRelation orderMaterialRelation);

    public Long updateOrderMaterialRelationsStatus(List<OrderMaterialRelation> orderMaterialRelations);

    public Long updateOrderMaterialRelationById(@Param("orderMaterialRelationId") Long orderMaterialRelationId);

    /**
    * 根据ID删除订单材料关系
    *
    * @param orderMaterialRelationId ID
    */
    public Long deleteOrderMaterialRelation(@Param("orderMaterialRelationId") Long orderMaterialRelationId);

    public Long deleteOrderMaterialRelationByOrderId(@Param("materialOrderId") Long materialOrderId);
}
